﻿using System;
using System.Collections.Generic;
using BusinessLogicLibrary.EmployeeModule;
using BusinessLogicLibrary.RoomModule;
using BusinessLogicLibrary.SupplyModule;
using entities;

namespace ServiceLibrary
{
    public class ManagerService : IManagerService
    {
        private readonly EmployeeManagement _employeeManagement = new EmployeeManagement();
        private readonly RoomManagement _roomManagement = new RoomManagement();
        private readonly SupplyManagement _supplyManagement = new SupplyManagement();

        #region"EMPLOYEE Management"

        public bool EmpEmailCheck(string email)
        {
            return _employeeManagement.CheckEmployeeEmail(email);
        }

        public string EmpAdd(string name, bool sex, DateTime birthday, string position, string phone, string email,string address, string city, string country, string jobtitle, byte[] image)
        {
            return _employeeManagement.AddEmployee(name, sex, birthday, position, phone, email, address, city,country, jobtitle, image);
        }
        
        public string EmpModify(string employeeID, string name, bool sex, DateTime birthday, string position,string phone,string email, string address, string city, string country, string jobtitle,byte[] image)
        {
            return _employeeManagement.ModifyEmployee(employeeID, name, sex, birthday, position, phone, email, address,city, country, jobtitle, image);
        }

        public string EmpDeactive(string employeeID)
        {
            return _employeeManagement.DeactiveEmployee(employeeID);
        }

        public List<vEmployeeSubDetail> EmpGet(bool all)
        {
            return _employeeManagement.GetEmployee(all);
        }

        public Employee EmpGetById(string employeeID)
        {
            Employee employee = _employeeManagement.GetEmployeeById(employeeID);
            return employee;
        }

        public List<vEmployeeSubDetail> EmpSearchByName(string val)
        {
            return _employeeManagement.SearchEmployeeByName(val);
        }

        #endregion

        #region "ROOM Management"

        public string EquAdd(string name, decimal price, bool available)
        {
            return _roomManagement.AddEquipment(name, price, available);
        }

        public List<EquipmentDetail> EquGet(bool available)
        {
            return _roomManagement.GetEquipment(available);
        }

        public EquipmentDetail EquGetByID(int id)
        {
            return _roomManagement.GetEquipmentByID(id);
        }

        public List<EquipmentDetail> EquGetByName(string name)
        {
            return _roomManagement.GetEquipmentByName(name);
        }

        public string EquModify(int id, string name, decimal price, bool available)
        {
            return _roomManagement.ModifyEquipment(id, name, price, available);
        }

        public RoomType RoTyGetByID(int id)
        {
            return _roomManagement.GetRoomTypeByID(id);
        }

        public List<RoomType> RoTyGet()
        {
            return _roomManagement.GetRoomType();
        }

        public List<EquipmentDetail> EquGetByRoomTypeID(int id)
        {
            return _roomManagement.GetEquipmentByRoomTypeID(id);
        }

        public string RoTyAdd(string title, string rank, decimal price, bool bath, bool view, bool balcon,
                              List<int> equipmentDetailID)
        {
            return _roomManagement.AddRoomType(title, rank, price, bath, view, balcon, equipmentDetailID);
        }

        public string RoTyModify(int id, string title, string rank, decimal price, bool bath, bool view,
                                 bool balcony, List<int> equipmentDetailId)
        {
            return _roomManagement.ModifyRoomType(id, title, rank, price, bath, view, balcony, equipmentDetailId);
        }

    
        public List<Room> RooGet(int available)
        {
            return _roomManagement.GetRoom(available);
        }

        public Room RooGetByID(int id)
        {
            return _roomManagement.GetRoomByID(id);
        }

        public List<Room> RooGetByRoTyID(int roomTypeId)
        {
            return _roomManagement.GetRoomByRoomTypeID(roomTypeId);
        }

        public string RooAdd(int roomId, int status, int roomTypeId)
        {
            return _roomManagement.AddRoom(roomId, status, roomTypeId);
        }

        public string RooModify(int roomId, int status, int roomTypeId)
        {
            return _roomManagement.ModifyRoom(roomId, status, roomTypeId);
        }

        #endregion

        #region "SUPPLY Management"

        public string SupDetailAdd(bool available, string supplyName, decimal price, string unit)
        {
            return _supplyManagement.AddSupplyDetail(available, supplyName, price, unit);
        }

        public string SupDetailModify(int id, bool available, string supplyName, decimal price, string unit)
        {
            return _supplyManagement.ModifySupplyDetail(id,available, supplyName, price, unit);
        }

        public List<SupplyDetail> SupDetailGet(bool available)
        {
            return _supplyManagement.GetSupplyDetail(available);
        }

        public SupplyDetail SupDetailGetById(int id)
        {
            return _supplyManagement.GetSupplyDetailByID(id);
        }
        
        public List<SupplyDetail> SupDetailGetByName(string name)
        {
            return _supplyManagement.GetSupplyDetailByName(name);
        }

        #endregion
    }
}